//
//  UIColor+HWCategory.h
//  OCDome
//
//  Created by 李含文 on 2020/11/9.
//  Copyright © 2020 李含文. All rights reserved.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

typedef enum : NSUInteger {
    HW_LEFT_RIGHT, ///<从左到右
    HW_TOP_BOTTOM, ///<从上到下
} HWColorGradientDirection;


@interface UIColor (HWCategory)

/// 16进制转颜色
/// @param hexString 16进制字符串
+ (UIColor *)hw_color:(NSString *)hexString;

/// 16进制转颜色
/// @param hexString 16进制字符串
/// @param alpha 透明度 0-1
+ (UIColor *)hw_color:(NSString *)hexString alpha:(CGFloat)alpha;

/// 渐变颜色
/// @param direction 渐变方向
/// @param frame 尺寸
/// @param start 开始颜色16进制
/// @param end 结束颜色16进制
+ (UIColor *)hw_gradientColor:(HWColorGradientDirection)direction frame:(CGRect)frame starthex:(NSString *)start endhex:(NSString *)end;

/// 渐变颜色
/// @param direction 渐变方向
/// @param frame 尺寸
/// @param start 开始颜色
/// @param end 结束颜色
+ (UIColor *)hw_gradientColor:(HWColorGradientDirection)direction frame:(CGRect)frame startColor:(UIColor *)start endColor:(UIColor *)end;

/// 随机颜色
+ (UIColor*)hw_randomColor;

+ (UIColor *)hw_colorWithRGB:(uint32_t)rgbValue;

- (uint32_t)hw_rgbValue;
@end

@interface NSString (HWColorCategory)

- (UIColor *)hw_toColor;

@end

NS_ASSUME_NONNULL_END
